/*
 * @Description:
 * @Version: 2.0
 * @Autor: wiz
 * @Date: 2023-07-05 08:58:01
 * @LastEditors: swc
 * @LastEditTime: 2024-01-20 13:24:45
 */
import { ifs, Tsrv } from '@/services';
import { N_oBaseGridPlus } from './types';

class T_cmd {
  // 主组件箱
  private compBox: ifs.I_compBox;

  // 主组件ID
  private compID: string;

  // 主组件实例
  private self: N_oBaseGridPlus.oBaseGridPlus;

  // 主组件created里初始化
  public init(self: any, compBoxInfo: ifs.I_compBoxInfo) {
    this.self = self;
    this.compBox = compBoxInfo.TcompBox;
    this.compID = compBoxInfo.compID;
  }

  public loadData() {
    this.self.G_gridOptions.data = [];
    Tsrv.ruleQuery<any>(this.self.config.tableName, [], {}, 10, 1).then(
      item => {
        const [b, res, d, m] = item;
        this.self.G_data = d;
        this.self.G_grid.loadData(d);
        this.self.$msg(m);
      }
    );
  }
}
export interface I_cmd extends T_cmd {}
export const Tcmd = new T_cmd();
